package my.action.authentication;
import javax.servlet.http.*;
import my.controller.*;
import my.db.DAO.AuthenticationDAO;
import my.db.DTO.AuthenticationDTO;
public class AuthenticationEditAction implements  Action{
	 public ActionForward execute(HttpServletRequest request,HttpServletResponse response) throws Exception{
			
		 //Fields
		 	AuthenticationDAO autDAO=new AuthenticationDAO();
		   	ActionForward forward=new ActionForward();	
		   	boolean help=true;
		 
		//Checking condition
	   		try{   			
	   			int accountid=Integer.parseInt(request.getParameter("accountID"));
	   			String pwd=request.getParameter("pwd");
	   			String npwd=request.getParameter("npwd");
	   			help=autDAO.resetPwd(accountid, npwd);
	   			if(help==true){
	   				forward.setPath("./list_author.article");
	   			}
	  		}catch(Exception ex){
	  			System.out.println(ex);
	   		}
	  		return forward;
		}  	
}